const keys = [
  'debug', 'error', 'info', 'log', 'warn',
  'dir', 'dirxml', 'table', 'trace',
  'group', 'groupCollapsed', 'groupEnd',
  'clear', 'count', 'assert', 'markTimeline',
  'profile', 'profileEnd', 'timeline', 'timelineEnd',
  'time', 'timeEnd', 'timeStamp'
];

const logger = {};

// 正式环境不输出日志，其他环境等同于console
if (process.env.NODE_ENV === 'production') {
  keys.forEach(key => (logger[key] = () => {}));
} else {
  keys.forEach(key => {
    /* eslint-disable */
    if (typeof console[key] === 'function') {
      logger[key] = console[key].bind(console);
    } else {
      logger[key] = () => {};
    }
  });
}

export default logger;
